package db.tables;

import java.sql.SQLException;

import org.hsqldb.Types;

import db.DBObject;

public class DBUserSettingsTable extends DBObject {
	public static final String TABLE_NAME = "user_settings";

	public static final String USER_ID_COL = DBUserTable.USER_ID_COL,
			LANGUAGE_ID_COL = DBLanguageTable.LANGUAGE_ID_COL,
			AVATAR_SUBTITLE_COL = "avatar_subtitle",
			BIRTHDAY_INFO_MAIL_COL = "birthday_info_mail",
			BIRTHDAY_INFO_DISPLAY_COL= "birthday_info_display";

	public DBUserSettingsTable() throws ClassNotFoundException, SQLException {
		super(
				TABLE_NAME,
				new Object[][] {
						{ USER_ID_COL, Types.BIGINT, SQL_NOT_NULL, "" },
						{ LANGUAGE_ID_COL, Types.BIGINT, SQL_NOT_NULL, "" },
						{ AVATAR_SUBTITLE_COL, Types.VARCHAR,"(30)", "////Shared////"},
						{ BIRTHDAY_INFO_MAIL_COL, Types.INTEGER, "",1},
						{ BIRTHDAY_INFO_DISPLAY_COL, Types.INTEGER, 
							getSQLCheck(BIRTHDAY_INFO_DISPLAY_COL+" <= 31")
							+getSQLCheck(BIRTHDAY_INFO_MAIL_COL+" <= 31")
							+getSQLForeignKeyReference(DBUserTable.TABLE_NAME,USER_ID_COL)
							+getSQLForeignKeyReference(DBLanguageTable.TABLE_NAME,LANGUAGE_ID_COL)
							, 3 } });
	}
}
